<template>
  <!-- 计划回款 -->
  <el-table :data="plancollectList" style="width: 100%">
    <el-table-column prop="planMoney" label="计划回款金额" width="250" />
    <el-table-column prop="num" label="回款期数" width="250" />
    <el-table-column prop="paymentName" label="回款方式" width="200" />
    <el-table-column prop="planTime" label="计划回款日期" width="300" />
    <el-table-column prop="remark" label="备注" min-width="200" />
  </el-table>
</template>

<script>
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'plancollectList',
  data () {
    return {
      plancollectList: [],
      typeList: []
    }
  },
  props: {
    list: {
      type: Array,
      required: true,
      default: () => { return [] }
    }
  },
  watch: {
    list (val) {
      if (val) {
        this.plancollectList = val
        this.typeList.forEach(item => {
          this.plancollectList.map(q_item => {
            if (q_item.planType == item.value) {
              q_item.paymentName = item.name
            }
          })
        })
      }
    }
  },
  mounted () {
    this.getRepaymentType()
  },
  methods: {
    // 获取回款方式
    async getRepaymentType () {
      let data = await queryTypeByDic('payment')
      this.typeList = data
    }
  }
}
</script>

<style>
</style>